<?php

namespace app\queue\stomp;

use app\queue\BaseConsumer;
use common\service\ApsService;
use common\service\NoteService;

class CreateNoteConsumer extends BaseConsumer
{

    // 要消费的队列名
    public $queue = 'create_note';

    // 连接名，对应 config/redis_queue.php 里的连接`
    public $connection = 'default';

    /**
     * 创建需求
     * @param $data
     * @return void
     */
    public function doConsume($data)
    {
        try {
            NoteService::getInstance()->createNote($data);
        } catch (\Throwable $e) {
            trace(format_exception_info($e), 'ERR');
        }
    }
}
